package sql.mysql;

import org.junit.Test;
import sun.security.util.Password;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

/**
 * Created by :Infaraway
 * DATE : 2017/3/4
 * Time : 21:41
 * Funtion :
 */
public class TestMysql {

    private static String driver = "com.mysql.jdbc.Driver" ;
    private static String url = "jdbc:mysql://localhost:3306/hibernate";
    private static String user = "root";
    private static String password = "root";

    @Test
    public void testMysql() throws SQLException {
        //获取数据库连接对象
        Connection conn = MysqlUtils.getConnection(driver, url, user, password);
        /*//查询数据库中所有的数据表
        List<String> tableList = MysqlUtils.getTables(conn);
        if (tableList != null){
            for (String s : tableList) {
                System.out.println(s);
            }
        }*/

        /*String sql = "insert into t_user(username, password, address) values(?,?,?)";
        boolean flag = MysqlUtils.update(sql, "cccz", "123", "xidian");
        System.out.println(flag);*/





        conn.close();
    }
}
